<?php
gatekeeper ();
$DEFAULT = "";
elgg_make_sticky_form ( 'editprojectslist_deadline' );

$deadline = get_input ( "deadline", 0 );
$projectlist_name = get_input ( "projectlist_name", 0 );
$projectlist_guid = get_input ( "projectlist_guid", 0 );

$metadata_options = array (
		array (
				'name' => 'group_project',
				'value' => $projectlist_name
		)
);

$options = array (
		'type' => "object",
		'subtype' => 'project',
		'container_guid' => $projectlist_guid,
		'metadata_name_value_pairs' => $metadata_options
);

$projects = elgg_get_entities_from_metadata ( $options );

foreach ($projects as $project){
	$project->deadline = $deadline;
}

elgg_clear_sticky_form ( 'editprojectslist_deadline' );
$listproj_url = elgg_get_site_url () . "submana/listpro/$projectlist_guid";
forward($listproj_url);